//
//  CalculatorAppViewController.h
//  CalculatorApp
//
//  Created by Michael Geering on 26/02/2010.
//  Copyright SDC 2010. All rights reserved.
//
// [View Controller]
// Manages aspects of the app's view and layout:
// * Button Randomiser

#import <UIKit/UIKit.h>
#import "customLabel.h"
#import "SettingsViewController.h"


#define kAccelerationThreshold	2.2 
#define kUpdateInterval	(1.0f/10.0f)

@interface CalculatorAppViewController : SettingsViewController <UIAccelerometerDelegate, SettingsViewControllerDelegate> {
	
	//Button Objects
	UIButton	*button1;
	UIButton	*button2;
	UIButton	*button3;
	UIButton	*button4;
	UIButton	*button5;
	UIButton	*button6;
	UIButton	*button7;
	UIButton	*button8;
	UIButton	*button9;
	UIButton	*button0;
	UIButton	*buttonPlus;
	UIButton	*buttonMinus;
	UIButton	*buttonMultiply;
	UIButton	*buttonDivide;
	UIButton	*buttonEquals;
	UIButton	*buttonClear;
	UIButton	*buttonPosNeg;
	UIButton	*buttonRand;
	UIButton	*buttonDecimal;
	customLabel *calcDisplay;
		
	//Randomiser Objects
	NSArray *xCoordArray;
	NSArray *yCoordArray;
	NSArray *buttonIdentity;
	NSArray *snarkyMessages;
	NSMutableArray *buttonIdentityRemain;
	NSMutableArray *xCoordRemain;
	NSMutableArray *yCoordRemain;
	
	double currentButton;
	double previousButton;	
	char currentModifier;
	char previousModifier;
	NSArray *modifier;
	
	//Decimal Point objects
	BOOL decimalUsed;
	double numDecimal;
	
	//Counts button presses
	int pressCount;
//	double RANDOM_CHANCE;
	
	//Accelerometer Objects
	BOOL screenBroken;
	UIImage *brokenImage;
	UIImageView *brokenView;
	
}

@property (nonatomic, retain) IBOutlet UIButton *button1;
@property (nonatomic, retain) IBOutlet UIButton *button2;
@property (nonatomic, retain) IBOutlet UIButton *button3;
@property (nonatomic, retain) IBOutlet UIButton *button4;
@property (nonatomic, retain) IBOutlet UIButton *button5;
@property (nonatomic, retain) IBOutlet UIButton *button6;
@property (nonatomic, retain) IBOutlet UIButton *button7;
@property (nonatomic, retain) IBOutlet UIButton *button8;
@property (nonatomic, retain) IBOutlet UIButton *button9;
@property (nonatomic, retain) IBOutlet UIButton *button0;

@property (nonatomic, retain) IBOutlet UIButton *buttonPlus;
@property (nonatomic, retain) IBOutlet UIButton *buttonMinus;
@property (nonatomic, retain) IBOutlet UIButton *buttonDivide;
@property (nonatomic, retain) IBOutlet UIButton *buttonMultiply;

@property (nonatomic, retain) IBOutlet UIButton *buttonClear;
@property (nonatomic, retain) IBOutlet UIButton *buttonPosNeg;
@property (nonatomic, retain) IBOutlet UIButton *buttonRand;
@property (nonatomic, retain) IBOutlet UIButton *buttonDecimal;
@property (nonatomic, retain) IBOutlet customLabel *calcDisplay;
@property (nonatomic, retain) IBOutlet UIButton *buttonEquals;




@property (nonatomic, retain) NSArray *xCoordArray;
@property (nonatomic, retain) NSArray *yCoordArray;
@property (nonatomic, retain) NSArray *buttonIdentity;
@property (nonatomic, retain) NSArray *snarkyMessages;
@property (nonatomic, retain) NSMutableArray *buttonIdentityRemain;
@property (nonatomic, retain) NSMutableArray *xCoordRemain;
@property (nonatomic, retain) NSMutableArray *yCoordRemain;

@property (nonatomic, retain) NSArray *modifier;

@property (nonatomic, retain) IBOutlet UIImageView *brokenView;
@property (nonatomic, retain) UIImage *brokenImage;

- (IBAction)PressedNum:(id)sender;
- (IBAction)PressedOperator:(id)sender;
- (IBAction)PressedClear:(id)sender;
- (IBAction)PressedPosNeg:(id)sender;
- (IBAction)PressedDecimal:(id)sender;
- (IBAction)equalsPressed:(id)sender;
- (IBAction)PressedRand;
- (IBAction)showSettings;

- (NSString *) getSnarkyMessage;

//- (void)resetButtonPosition;

@end

